package com.yy.micro.magic.data.model.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yy.micro.magic.data.model.base.JpaObjectWithDynamicFields;

import java.util.HashMap;
import java.util.Map;

public abstract class JpaObjectWithDynamicFieldsVo extends JpaObjectVo{

    private Map<String, Object> dynamicFields = new HashMap<>(8);

    public Map<String, Object> getDynamicFields() {
        return dynamicFields;
    }

    public void setDynamicFields(Map<String, Object> dynamicFields) {
        this.dynamicFields = dynamicFields;
    }

    @JsonIgnore
    public void from(JpaObjectWithDynamicFields from){
        super.from(from);
        setDynamicFields(from.getDynamicFields());
    }

    @JsonIgnore
    public void to(JpaObjectWithDynamicFields to){
        super.to(to);
        to.setDynamicFields(getDynamicFields());
    }
}
